import { request } from '@/service/request';
import { removeEmptyProps } from '@/utils/common';
import type { Log } from '../../types/log';

export function statsLoginLogs(params?: any) {
  return request<Log.LogingLogstatsVO>({
    url: '/monitor/logininfor/logs/stats',
    method: 'get',
    params
  });
}
export function countLoginStatus() {
  return request<{
    success: number;
    error: number;
  }>({
    url: '/monitor/logininfor/logs/count',
    method: 'get'
  });
}
export function getPageList(params?: any) {
  const requestParams = removeEmptyProps(params);
  return request<Log.LoginVO>({
    url: '/monitor/logininfor/list',
    method: 'get',
    params: requestParams
  });
}

/** 清空登录日志 */
export function clean(type: string | number) {
  return request({
    url: `/monitor/logininfor/clean/${type}`,
    method: 'DELETE'
  });
}
